MicroDexed is a compatible 6-operator-FM-synth based on the Teensy(-3.6/-4.0) Microcontroller. https://www.parasitstudio.de
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
1.1KB

  1. /*
  2. * Copyright 2013 Google Inc.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. // A convenient wrapper for buffers with alignment constraints
  17. // Note that if we were on C++11, we'd use aligned_storage or somesuch.
  18. #ifndef __ALIGNED_BUF_H
  19. #define __ALIGNED_BUF_H
  20. #include<stddef.h>
  21. template<typename T, size_t size, size_t alignment = 16>
  22. class AlignedBuf {
  23. public:
  24. T *get() {
  25. return (T *)((((intptr_t)storage_) + alignment - 1) & -alignment);
  26. }
  27. private:
  28. unsigned char storage_[size * sizeof(T) + alignment];
  29. };
  30. #endif // __ALIGNED_BUF_H